#ifndef PALETTE_PALETTE_H
#define PALETTE_PALETTE_H

#include <common/Palette.h>
#include <common/color.h>
#include <common/exception.h>
#include <utility>
#include <vector>

class Palette : public IPalette
{
private:
    std::vector<Color> cv;
public:
    explicit Palette(std::vector<Color> cv_) : cv(std::move(cv_)) { }
    [[nodiscard]] const Color& GetColor(size_t index) const override
    {
        if (index >= cv.size())
            throw ArrayIndexOutOfBoundsException("Palette GetColor index out of bounds.");
        return cv[index];
    }

    [[nodiscard]] size_t GetLength() const override
    {
        return cv.size();
    }
};

#endif //PALETTE_PALETTE_H
